<?php

require_once(sfConfig::get('sf_lib_dir').'/filter/doctrine/BaseFormFilterDoctrine.class.php');

/**
 * Midia filter form base class.
 *
 * @package    filters
 * @subpackage Midia *
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 11675 2008-09-19 15:21:38Z fabien $
 */
class BaseMidiaFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'nm_midia'   => new sfWidgetFormFilterInput(),
      'ds_midia'   => new sfWidgetFormFilterInput(),
      'id_sistema' => new sfWidgetFormDoctrineChoice(array('model' => 'Sistema', 'add_empty' => true)),
      'id_item'    => new sfWidgetFormDoctrineChoice(array('model' => 'Item', 'add_empty' => true)),
      'user_id'    => new sfWidgetFormDoctrineChoice(array('model' => 'sfGuardUserProfile', 'add_empty' => true)),
      'id_evento'  => new sfWidgetFormDoctrineChoice(array('model' => 'Evento', 'add_empty' => true)),
      'id_galeria' => new sfWidgetFormDoctrineChoice(array('model' => 'Galeria', 'add_empty' => true)),
      'id_pagina'  => new sfWidgetFormDoctrineChoice(array('model' => 'Pagina', 'add_empty' => true)),
      'created_at' => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => true)),
      'updated_at' => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => true)),
    ));

    $this->setValidators(array(
      'nm_midia'   => new sfValidatorPass(array('required' => false)),
      'ds_midia'   => new sfValidatorPass(array('required' => false)),
      'id_sistema' => new sfValidatorDoctrineChoice(array('required' => false, 'model' => 'Sistema', 'column' => 'id_sistema')),
      'id_item'    => new sfValidatorDoctrineChoice(array('required' => false, 'model' => 'Item', 'column' => 'id_item')),
      'user_id'    => new sfValidatorDoctrineChoice(array('required' => false, 'model' => 'sfGuardUserProfile', 'column' => 'user_id')),
      'id_evento'  => new sfValidatorDoctrineChoice(array('required' => false, 'model' => 'Evento', 'column' => 'id_evento')),
      'id_galeria' => new sfValidatorDoctrineChoice(array('required' => false, 'model' => 'Galeria', 'column' => 'id_galeria')),
      'id_pagina'  => new sfValidatorDoctrineChoice(array('required' => false, 'model' => 'Pagina', 'column' => 'id_pagina')),
      'created_at' => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
      'updated_at' => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
    ));

    $this->widgetSchema->setNameFormat('midia_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'Midia';
  }

  public function getFields()
  {
    return array(
      'id_midia'   => 'Number',
      'nm_midia'   => 'Text',
      'ds_midia'   => 'Text',
      'id_sistema' => 'ForeignKey',
      'id_item'    => 'ForeignKey',
      'user_id'    => 'ForeignKey',
      'id_evento'  => 'ForeignKey',
      'id_galeria' => 'ForeignKey',
      'id_pagina'  => 'ForeignKey',
      'created_at' => 'Date',
      'updated_at' => 'Date',
    );
  }
}